<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            width: 200px;
            height: 200px;
            background-color: pink;
        }

        .box2 {
            border: 2px solid skyblue;
        }

        .orange {
            border: 2px solid orange;
        }

        .red {
           background: red;
        }

        #app div {
            width: 80px;
            height: 40px;
            border: 1px solid #999;
            float: left;
            margin: 20px;
        }
    </style>
</head>
<body>
    <div id="app">
       <div v-for="(item, index) in arr" @click="change(index)" :class="index === idx? 'red': ''">{{ item }}</div>
    </div>
    <script src="./node_modules/vue/dist/vue.js"></script>
    <script>
        new Vue({
            el: '#app',
            // 定义数据
            data: {
               arr: ['111', '222', '333', '444'],
               idx: 0
            },
            // 定义方法
            methods: {
              change(index) {
                this.idx = index
              }
            }
        })
    </script>
</body>
</html>